#pragma once
#include "Hittable.h"
#include "Util.h"

class CSphere : public CHittable {
public:
	CSphere(const Point3& vStaticCenter, double vRadius, shared_ptr<CMaterial> vMat);
	CSphere(const Point3& vCenter1, const Point3& vCenter2, double vRadius, shared_ptr<CMaterial> vMat);
	bool hit(const CRay& vRay, CInterval vRayT, CHitRecord& vHitRecord) const override;

	CAABB boundingBox()const override { return m_BBox; }

private:
	CRay m_CenterRay;
	double m_Radius;
	shared_ptr<CMaterial> m_pMat;
	CAABB m_BBox;

	static void __getSphereUV(const Point3& vPoint, double& u, double& v);
};